import { request, DEFAULT_BASE_URL, getToken } from "@/utils/request.js";


//获取助手数据
export function getAssistant(type) {
    return request({
        url: `/api/v1/hospital/assistant?type=${type}`,
        method: "get",
    });
}

//获取产品列表
export function getProducts(data) {
    return request({
        url: `/api/v1/hospital/goods?pageSize=${data.pageSize}&page=${data.page}&en_name=${data.name}&zh_name=${data.name}&type=${data.type}`,
        method: "get",
    });
}

// 提交治疗记录
export function treatmentRecord(data) {
    return request({
      url: '/api/v1/hospital/treatmentRecord',
      method: 'POST',
      data
    })
  }
//获取治疗记录列表
export function getOrderList(data) {
    return request({
        url: `/api/v1/hospital/treatmentRecord?pageSize=${data.pageSize}&page=${data.page}`,
        method: "get",
        data: data
    });
}

//获取治疗记录详情
export function getOrderDetail(outpatient_no) {
    return request({
        url: `/api/v1/hospital/treatmentRecord/${outpatient_no}`,
        method: "get",
        showLoading: false,
    });
}

//获取诊断报告状态
export function getDiagnoseReportStatus() {
    return request({
        url: `/api/v1/hospital/diagnoseReport/status`,
        method: "get",
        showLoading: false,
    });
}

// 创建诊断报告
export function createDiagnoseReport() {
    return request({
        url: `/api/v1/hospital/diagnoseReport`,
        method: "post",
        showLoading: false,
    });
}

// 获取诊断报告
export function getDiagnoseReport(rep_id) {
    return request({
        url: `/api/v1/hospital/diagnoseReport/${rep_id}`,
        method: "get",
        showLoading: false,
    });
}

// 获取诊断报告列表
export function getDiagnoseReportList(data) {
    let url = `/api/v1/hospital/diagnoseReport?pageSize=${data.pageSize}&page=${data.page}`
    
    // 如果有日期参数，添加到URL中
    if (data.date) {
        url += `&date=${data.date}`
    }
    
    return request({
        url: url,
        method: "get",
        data: data,
        showLoading: false,
    });
}

// 获取诊断报告PDF文件
export function getPDFFile(rep_id) {
    return request({
        url: `/api/v1/hospital/diagnoseReport/file?rep_id=${rep_id}`,
        method: "get",
        showLoading: false,
    });
}


